package com.atguigu.app

import org.apache.spark.streaming.StreamingContext

abstract class BaseApp {
  //希望子类提供，声明为抽象属性，让子类继承后重写
  var appName: String
  var internal: Int
  var sc: StreamingContext = null

  def runApp(op: => Unit) {
    try {



      op //自己定义的一段代码逻辑

      sc.start()
      sc.awaitTermination()
    } catch {
      case ex: Exception => println(ex.getMessage)
    }finally {
      //异常就关闭sc
      sc.stop(true,true)
    }
  }
}
